package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.IndexTitleMapper;
import com.ruoyi.system.domain.IndexTitle;
import com.ruoyi.system.service.IIndexTitleService;
import com.ruoyi.common.core.text.Convert;

/**
 * 网站栏目Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-24
 */
@Service
public class IndexTitleServiceImpl implements IIndexTitleService 
{
    @Autowired
    private IndexTitleMapper indexTitleMapper;

    /**
     * 查询网站栏目
     * 
     * @param id 网站栏目ID
     * @return 网站栏目
     */
    @Override
    public IndexTitle selectIndexTitleById(Long id)
    {
        return indexTitleMapper.selectIndexTitleById(id);
    }

    /**
     * 查询网站栏目列表
     * 
     * @param indexTitle 网站栏目
     * @return 网站栏目
     */
    @Override
    public List<IndexTitle> selectIndexTitleList(IndexTitle indexTitle)
    {
        return indexTitleMapper.selectIndexTitleList(indexTitle);
    }

    /**
     * 新增网站栏目
     * 
     * @param indexTitle 网站栏目
     * @return 结果
     */
    @Override
    public int insertIndexTitle(IndexTitle indexTitle)
    {
        indexTitle.setCreateTime(DateUtils.getNowDate());
        return indexTitleMapper.insertIndexTitle(indexTitle);
    }

    /**
     * 修改网站栏目
     * 
     * @param indexTitle 网站栏目
     * @return 结果
     */
    @Override
    public int updateIndexTitle(IndexTitle indexTitle)
    {
        indexTitle.setUpdateTime(DateUtils.getNowDate());
        return indexTitleMapper.updateIndexTitle(indexTitle);
    }

    /**
     * 删除网站栏目对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteIndexTitleByIds(String ids)
    {
        return indexTitleMapper.deleteIndexTitleByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除网站栏目信息
     * 
     * @param id 网站栏目ID
     * @return 结果
     */
    @Override
    public int deleteIndexTitleById(Long id)
    {
        return indexTitleMapper.deleteIndexTitleById(id);
    }

    /**
     * 通过排序查询网站栏目列表
     * @return
     */
    @Override
    public List<IndexTitle> selectIndexTitleListBySort() {
        return indexTitleMapper.selectIndexTitleListBySort();
    }
}
